﻿#define _CRT_SECURE_NO_WARNINGS 1

//编程初学者入门训练第九十八题
//BC100 有序序列合并
//https://www.nowcoder.com/practice/a9e943b0dab142759807d0cfb6863897?tpId=107&tqId=33381&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3Fpage%3D2%26tpId%3D107%26type%3D107&difficulty=undefined&judgeStatus=undefined&tags=&title=

#include<stdio.h>

int main()
{
    int n = 0, m = 0;
    scanf("%d %d\n", &n, &m);
    int i = 0, j = 0, arr[2000];
    int temp = 0;
    //存储第一个数组
    for (i = 0; i < n; i++)
    {
        scanf("%d ", &arr[i]);
    }
    //存储第二个数组
    for (i = n; i < n + m; i++)
    {
        scanf("%d ", &arr[i]);
    }
    //对数组排序
    for (i = 0; i < n + m; i++)
    {
        for (j = 0; j < n + m - i - 1; j++)
        {
            if (arr[j] > arr[j + 1])
            {
                temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
            }
        }
    }
    //打印数组
    for (i = 0; i < n + m; i++)
    {
        printf("%d ", arr[i]);
    }

    return 0;
}
